/* 
 * File:   BinaryOperator.h
 * Author: Gab'z
 *
 * Created on 31 mai 2012, 15:23
 */

#ifndef BINARYOPERATOR_H
#define	BINARYOPERATOR_H

#include "../Operator.h"
#include "../../literal/Number.h"

namespace calculator {

    class BinaryOperator : public Operator {
    public:
        virtual std::string isExecutable() const;
        virtual BinaryOperator* clone() const = 0;

        const Memento* createMemento() const  throw (CommandException);

    protected:
        virtual const Number* apply(const Number* n1, const Number* n2) const throw (ArithmeticException) = 0;
        BinaryOperator(const std::string name);
        virtual ~BinaryOperator();
    private:
        void eval(Stack* stack) const throw (CommandException);
        BinaryOperator(const BinaryOperator& orig);
    };
}

#endif	/* BINARYOPERATOR_H */

